package com.vesystem.vegua.modules.common.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.vesystem.vegua.modules.common.entity.MappingUserApp;
import com.vesystem.vegua.modules.common.mapper.MappingUserAppMapper;
import com.vesystem.vegua.modules.common.service.IMappingUserAppService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hcy
 * @since 2020-12-08
 */
@Service
public class MappingUserAppServiceImpl extends ServiceImpl<MappingUserAppMapper, MappingUserApp> implements IMappingUserAppService {

    @Autowired
    private MappingUserAppMapper mappingUserAppMapper;

    public void updateMappingUserApp(Integer userId, List<Integer> appId){
        QueryWrapper qw = new QueryWrapper();
        qw.eq("user_id",userId);
        mappingUserAppMapper.delete(qw);
        mappingUserAppMapper.batchInsertMappingUserApp(userId,appId);
    }

    public List<Integer> getAppIdsByUserId(Integer userId){
        return mappingUserAppMapper.getAppIdsByUserId(userId);
    }



}
